Skip to content

feat(parquet): add uses_key_retriever method to FileDecryptionProperties - #9895

Merged
alamb merged 4 commits into
apache:mainfrom
adamreeve:uses-key-retriever
Jun 2, 2026
Merged

feat(parquet): add uses_key_retriever method to FileDecryptionProperties#9895
alamb merged 4 commits into
apache:mainfrom
adamreeve:uses-key-retriever

Conversation

@adamreeve

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Are these changes tested?

Yes, includes new unit tests.

Are there any user-facing changes?

Yes, there is a new public API method.

@github-actions github-actions Bot added the parquet Changes to the parquet crate label May 5, 2026
@adamreeve
adamreeve force-pushed the uses-key-retriever branch from 00774cf to 6f1492f Compare June 1, 2026 20:42
@adamreeve
adamreeve marked this pull request as ready for review June 1, 2026 20:57
@adamreeve
adamreeve requested a review from rok June 1, 2026 20:58
Comment thread parquet/src/encryption/decrypt.rs Outdated
}

/// Whether these decryption properties use a key retriever.
/// When false, keys can be retrieved without providing key metadata.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// When false, keys can be retrieved without providing key metadata.
/// When false, explicit keys were provided up front rather than resolved on demand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've incorporated this suggestion but kept the bit about not needing to provide key metadata to retrieve keys, which I think is useful to document.

Comment thread parquet/tests/encryption/encryption.rs Outdated
Comment on lines +1492 to +1499
let column_1_key = "1234567890123450".as_bytes();
let column_2_key = "1234567890123451".as_bytes();

let properties_with_keys = FileDecryptionProperties::builder(footer_key.to_vec())
.with_column_key("double_field", column_1_key.to_vec())
.with_column_key("float_field", column_2_key.to_vec())
.build()
.unwrap();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need two column keys?

Suggested change
let column_1_key = "1234567890123450".as_bytes();
let column_2_key = "1234567890123451".as_bytes();
let properties_with_keys = FileDecryptionProperties::builder(footer_key.to_vec())
.with_column_key("double_field", column_1_key.to_vec())
.with_column_key("float_field", column_2_key.to_vec())
.build()
.unwrap();
let column_key = "1234567890123450".as_bytes();
let properties_with_keys = FileDecryptionProperties::builder(footer_key.to_vec())
.with_column_key("double_field", column_1_key.to_vec())
.build()
.unwrap();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I've changed to one column key and switched to using the new constants that were added recently.

.build()
.unwrap();

assert!(!properties_with_keys.uses_key_retriever());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe test uniform case as well?

Suggested change
assert!(!properties_with_keys.uses_key_retriever());
assert!(!properties_with_keys.uses_key_retriever());
let properties_uniform = FileDecryptionProperties::builder(footer_key.to_vec())
.build()
.unwrap();
assert!(!properties_uniform.uses_key_retriever());

@rok rok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the design. Minor comment and test nits.

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @adamreeve and @rok -- looks good to me

@rok rok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, sorry for the yak shave. I think this is good to go @alamb :)

@alamb
alamb merged commit 259cff2 into apache:main Jun 2, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[parquet] Expose whether FileDecryptionProperties uses a KeyRetriever

3 participants